home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
5
/
TIME_ZON
/
CNOBJECT.C
< prev
next >
Wrap
Text File
|
1991-11-08
|
2KB
|
116 lines
/* CNObject.c
* This object has a name.
*/
#include "CNObject.h"
#include <string.h>
char gNextChar = 'A';
void
CNObject::INObject()
{
/*
* Okay, so it's not named yet.
*/
name[0] = '\0';
}
void
CNObject::DisposeComplete()
{
/*
* In general, Dispose is sufficient. But if you need to
* completely dump the object (even from a file where it's
* kept - see CZone) this can be overridden
*/
Dispose();
}
void
CNObject::SetName(theName)
char *theName;
{
/*
* Copy in the new name.
*/
strncpy(name,theName,39);
}
void
CNObject::GetName(theName)
char *theName;
{
/*
* Get a copy of the name. Note that the owner of the string
* is the caller.
*/
strcpy(theName,name);
}
int
CNObject::CompareName(theName)
char *theName;
{
/*
* Okay, so compare them
*/
return(strcmp(theName,name));
}
Boolean
CNObject::NameEquals(theName)
char *theName;
{
/*
* Are these exactly equal?
*/
return(strcmp(theName,name) == 0);
}
Boolean
CNObject::PartEquals(theName)
char *theName;
{
/*
* Are these equal to the length of the input string?
*/
return(strncmp(theName,name,strlen(theName)) == 0);
}
Boolean
CNObject::NameGreater(theName)
char *theName;
{
/*
* Is the name of the object greater than the name of the
* input string?
*/
return(strcmp(theName,name) < 0);
}
Boolean
CNObject::Edit()
{
/* Nothing is the default, so if the object needs to be able to
* edit itself, this should be overridden.
*/
}